home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / gfxfx / putinc.pas < prev    next >
Pascal/Delphi Source File  |  1994-03-20  |  973b  |  49 lines

  1.  
  2. {$g+}
  3. program displaypackedpic;
  4. { display packed picture in mode 13h, by Bas van Gaalen, Holland, PD }
  5. uses crt;
  6. const
  7. {$i incfile.inc}
  8. var
  9.   i,j,num,ofs : word;
  10.   inbyte : byte;
  11.  
  12. procedure setpalette(var pal); assembler;
  13. asm
  14.   push ds
  15.   mov dx,03c8h
  16.   xor ax,ax
  17.   out dx,al
  18.   inc dx
  19.   lds si,pal
  20.   mov cx,0300h
  21.   rep outsb
  22.   pop ds
  23. end;
  24.  
  25. begin
  26.   { set graphics and palette }
  27.   asm mov ax,13h; int 10h; end;
  28.   setpalette(pal);
  29.  
  30.   { unpack picture to screen }
  31.   i := 0;
  32.   while i < sizeof(pic) do begin
  33.     inbyte := pic[i];
  34.     if inbyte = 0 then begin
  35.       inbyte := pic[i+1];
  36.       num := pic[i+2]+256*pic[i+3];
  37.       for j := 0 to num-1 do mem[sega000:ofs+j] := inbyte;
  38.       inc(ofs,num); inc(i,4);
  39.     end else begin
  40.       mem[sega000:ofs] := inbyte;
  41.       inc(ofs); inc(i);
  42.     end;
  43.   end;
  44.  
  45.   { wait for key and clearkeybuf }
  46.   repeat until keypressed; while keypressed do readkey;
  47.   asm mov ax,3; int 10h; end;
  48. end.
  49.